<%-- 
    Document   : FormChattingServer
    Created on : 28 Nov 12, 16:55:10
    Author     : ASUS 1215P
--%>

<%@page import="aktor.ChattingPasien"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%
 //String id_pasien = "0001";
  String id_pasien = session.getAttribute("password").toString();
%>
<html xmlns="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Apuppy</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="apuppy_style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
function clearText(field)
{
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}
</script>
 <script>
            function isiID(id){
                
                document.getElementById('IdKonsultan').value = id;
            }
        </script>
 </head>
    <body>
        <div id="templatemo_header_wrapper">

            <div id="templatemo_header">

                <div id="site_title">
                    <h1><a href="index.jsp" target="_parent ">
                            Apuppy
                        </a></h1>
                </div>

                <div id="templatemo_menu">
                    <ul>
                        <li><a href="index.jsp" class="current">Home</a></li>
                        <li><a href="profile.jsp" target="_parent">profile</a></li>
                        <li><a href="formPendaftaran.jsp" target="_parent">pendaftaran</a></li>
                    </ul>    	
                </div> <!-- end of templatemo_menu -->



                <div class="cleaner"></div>
            </div> <!-- end of templatemo_header -->

        </div> 
        <!-- end of templatemo_header_wrapper -->

        <div id="templatemo_content_wrapper">

            <div id="">

                <div class="content_section">
                            
                        </head>
                        <center>                                <h1>Selamat Datang di Halaman Chatting</h1>
                                <table border="1">
                                    <tbody>
                                        <tr>
                                            <td width="300" height="400" style="vertical-align: top;">
                                                <table bgcolor="LimeGreen"><tbody>
                                        <tr>
                                            <td width="300" height="50" style="vertical-align: top;"><b><U>Inbox</u></b></td></tr>
                                                        <%
                                                            ArrayList<ChattingPasien> inbox = new ChattingPasien().getInbox(id_pasien);
                                                            for (int i = 0; i < inbox.size(); i++) {
                                                                if (i % 2 == 0) {
                                                        %>

                                        <tr>
                                            <td width="300" height="50" bgcolor="bisque"><%= inbox.get(i).getPesan()%> <br>
                                                <button onclick="isiID('<%= inbox.get(i).getId_pengirim()%>')">balas</button></td></tr>
                                                <%} else {%>
                                        <tr>
                                            <td width="300" height="50" bgcolor="lightgray"><%= inbox.get(i).getPesan()%> <br>
                                                <button onclick="isiID('<%= inbox.get(i).getId_pengirim()%>')">balas</button></td></tr>

                                        <%
                                                }
                                            }
                                        %>
                                    </tbody>
                                </table>
                            </td>
                            <td width="300" height="400" style="vertical-align: top;">
                                <table bgcolor="white"><tbody>
                                        <tr>
                                            <td width="300" height="50" style="vertical-align: top;"><b><U>Outbox</u></b></td></tr>
                                                        <%
                                                            ArrayList<String> outbox = new ChattingPasien().getOutbox(id_pasien);
                                                            for (int i = 0; i < outbox.size(); i++) {
                                                                if (i % 2 == 0) {
                                                        %>

                                        <tr>
                                            <td width="300" height="50" bgcolor="bisque"><%= outbox.get(i)%> </td></tr>
                                            <%} else {%>
                                        <tr>
                                            <td width="300" height="50" bgcolor="lightgray"><%= outbox.get(i)%> </td></tr>

                                        <%
                                                }
                                            }
                                        %>
                                    </tbody>
                                </table>
                            </td>
                            <td bgcolor="PaleGreen" width="500" style="vertical-align: top;">
                               <form action="chatPasien">
                                <table>
                                    <tbody>
                                        <tr>
                                            <td>
                                                <b>Id Konsultan :</b>
                                                <input name="idKonsultan" id="IdKonsultan" value="<%= request.getParameter("konsultan")%>" type="text" size="40" class="i" autocomplete="off">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <b>Id Pasien    :</b>
                                                <input name="idPasien" id="IdPasien" value="<%= id_pasien%>" type="text" size="40" class="i" autocomplete="off">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <b>Pesan </b>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <textarea name="pesan" title="Message Body" rows="15" cols="50" wrap="virtual" class="mi">
                                                </textarea>
                                            <td>
                                        </tr>
                                        <tr> 
                                            <td> <input type="submit" name="send" value="Kirim">&nbsp;
                                                <input type="submit" value="back" name="back" formaction="index.jsp" /> &nbsp;
                                             </td>
                                                            </tr>
                                                    </table>
                                                </form>
                                </table>
                        </center>
                                                
                                                
                                                </div>




                                                </div> 




                                                </div> <!-- end of content -->




     <div id="templatemo_footer">

                                                    <ul class="footer_menu">

                                                    </ul>

                                                    Copyright Â© 2048 <a href="#">Apuppy 2010</a> | 
                                                    Designed by <a href="" target="_parent">Apuppy Klinik Gizi Online</a> | 
                                                    <a href="https://www.usd.ac.id">www.usd.ac.id</a>
                                                </div> <!-- end of templatemo_footer -->
                                                </body>
                                                </html>
